package net.lab1024.sa.admin.module.business.erp.controller;

import net.lab1024.sa.admin.module.business.erp.domain.entity.MmordbEntity;
import net.lab1024.sa.admin.module.business.erp.domain.entity.NmmordaEntity;
import net.lab1024.sa.admin.module.business.erp.domain.form.add.NmmordaAddForm;
import net.lab1024.sa.admin.module.business.erp.domain.form.query.MmordbQueryForm;
import net.lab1024.sa.admin.module.business.erp.domain.form.query.NmmordaQueryForm;
import net.lab1024.sa.admin.module.business.erp.domain.form.update.NmmordaUpdateForm;
import net.lab1024.sa.admin.module.business.erp.domain.vo.NmmordaVO;
import net.lab1024.sa.admin.module.business.erp.service.NmmordaService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 生产订单与用户关系表 Controller
 *
 * @Author AKITA
 * @Date 2025-04-19 13:01:26
 * @Copyright AKITA
 */

@RestController
@Tag(name = "生产订单与用户关系表")
public class NmmordaController {

    @Resource
    private NmmordaService nmmordaService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/nmmorda/queryPage")

    public ResponseDTO<PageResult<NmmordaVO>> queryPage(@RequestBody @Valid NmmordaQueryForm queryForm) {
        return ResponseDTO.ok(nmmordaService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/nmmorda/add")

    public ResponseDTO<String> add(@RequestBody @Valid NmmordaAddForm addForm) {
        return nmmordaService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/nmmorda/update")

    public ResponseDTO<String> update(@RequestBody @Valid NmmordaUpdateForm updateForm) {
        return nmmordaService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/nmmorda/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return nmmordaService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/nmmorda/delete/{docEntry}")

    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return nmmordaService.delete(docEntry);
    }

    @PostMapping("/nmmordb/deleteLine")
    public ResponseDTO<String> deleteLine(@RequestBody NmmordaQueryForm queryForm) {
        return nmmordaService.deleteLine(queryForm);
    }

    @PostMapping("/nmmordb/list")
    public ResponseDTO<List<NmmordaEntity>> list(@RequestBody MmordbQueryForm queryForm) {
        return ResponseDTO.ok(nmmordaService.list(queryForm));
    }
}
